import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-10-04
 * Time: 20:19
 */
public class Demo1 {
    public static void main(String[] args) throws IOException {
        try (Reader reader = new FileReader("d:/test.txt")) {
            while (true) {
                //这个read方法中没有传入参数，一次只读取一个字符
                int ret = reader.read();
                if (ret == -1) break;
                char ch = (char)ret;
                System.out.println(ch);
            }
        }
    }
}
